﻿using STHPMS1.BLL.B_Core;
using STHPMS1.Common.C_Entity.Stmpms1;
using STHPMS1.ICore.I_BLL.Bus;
using STHPMS1.ICore.I_DAL;
using STHPMS1.ICore.I_Entity.Info;
using STHPMS1.ICore.I_Entity.Stmpms1;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Data;
namespace STHPMS1.BLL.B_Bus
{
    public class S_InspeaccseBus : BllBase, IS_InspeaccseBill
    {
        public void Save<T>(T entity)
            where T : class ,IS_Inspeaccse
        {
            this.Scene.Dal.Sthpms1.Save(entity);
        }

        public void Remove(IS_Inspeaccse entity)
        {
            this.Scene.Dal.Sthpms1.Delete(entity);
        }

        public IEnumerable<T> Get<T>(Expression<Func<T, bool>> predicate, IPagingInfo info)
            where T : class, IS_Inspeaccse
        {
            return this.Scene.Dal.Sthpms1.Select<T>(predicate, info);
        }
        public bool Exists(string inspecId)
        {
            return this.Scene.Dal.Sthpms1.Exists<IS_Inspeaccse>(new { Inspecid = inspecId });
        }

        public bool UpdateStatus(string inspecId,string typeColumn)
        {
            return this.Scene.Dal.Sthpms1.S_Inspeaccse.UpdateStatus(inspecId, typeColumn);
        }

        public List<string> List(string rdwayid)
        {
            ISthpms1Dao dao = this.Scene.Dal.Sthpms1;
            return dao.Column<string>(dao.From<S_Inspeaccse>().Select(x => x.Inspecid)
                         .Where(q => q.Inspecid.StartsWith(rdwayid)));
        }

        public void UpdateUnit(string tableName, List<DataRow> olds, string inspecid)
        {
             this.Scene.Dal.Sthpms1.S_Inspeaccse.UpdateUnit(tableName, olds, inspecid);
        }

        public System.Data.DataTable GetRdway(string tableName, string inspecid)
        {
            return this.Scene.Dal.Sthpms1.S_Inspeaccse.GetRdway(tableName, inspecid);
        }

        public System.Data.DataTable GetInspeaccseData(string rdid, string inspecid, int dir,string tableName)
        {
            return this.Scene.Dal.Sthpms1.S_Inspeaccse.GetInspeaccseData(rdid, inspecid, dir,tableName);
        }

        public bool Exists(string unit, string inspecid, string tableName, string svydate)
        {
           
                return this.Scene.Dal.Sthpms1.S_Inspeaccse.Exists(unit, inspecid, tableName,svydate);//查找重复评定的日期
         
        }
    }
}
